{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "8554e966",
   "metadata": {},
   "source": [
    "## Removing Falses from List"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "4fd8fcaa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Sahil', 1, ' ']"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "names=['Sahil',1,0,False,None,\"\",\" \"]\n",
    "[i for i in names if i]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "50145f92",
   "metadata": {},
   "source": [
    "- The last section if i removes all the false and in python : 0,False,empty strings are considered false"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "b27f6b51",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Sahil', 1]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[i for i in names if i and i!=\" \"]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d3b06377",
   "metadata": {},
   "source": [
    "- adding one more condition will remove those spaces also"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}